home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / DATABASE / OBJ1_2.ZIP;1 / DEMO1.PRG < prev    next >
Encoding:
Text File  |  1993-01-08  |  4.0 KB  |  83 lines

  1. //*****************************************************************************
  2. //                                 Demo1.prg
  3. // ⁄ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒø
  4. // ≥         Simple (trivial) demo application created with OBJECT.lib        ≥
  5. // ≥       Length of source code is (without notes) 45 lines, 1310 bytes      ≥
  6. // ¿ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŸ
  7. //                        (c) 1991, JHK, JHK-Software, Piestany
  8. //
  9. //                Author:
  10. //                          Jan Hercek
  11. //                          JHK-Software
  12. //                          N.Teslu 26
  13. //                  92101   Piestany
  14. //                          Slovak republic
  15. //                          (in central Europe)
  16. //
  17. //                          (tel: +42/838/21782)
  18. //
  19. //                Compile with Clipper.exe, switches: /N/M/W/A
  20. //                Link command: RtLink FI Demo1 LIB Object
  21. //                          or: RtLink FI Demo1 PLL Object
  22. //*****************************************************************************
  23.  
  24. #include "Set.ch"
  25. #include "InKey.ch"
  26. #include "Object.ch"
  27.  
  28. static oD,oV,oM      //objects: Database,View,Menu
  29.  
  30. procedure Main(clr)               //clr=color definition (please run this program with a parameter /?)
  31.   ObjectInit(clr,"Demo1",2,1992)  //init of library, parameters: colors, program_name,version,year
  32.   object oD of Dbf  init DInit()  //open/create the database files, strukture is in DInit(); if a password is required, then user is prompted for it.
  33.   object oV of View init VInit()  //edit/view window, definition: indexes, filters, reports.
  34.   object oM of Menu init MInit()  //create menu system.
  35.   oM:Process()                    //main program loop
  36.   ObjectDone()                    //destroy the object system (close dabases, restore screen)
  37.   return                          //return into DOS
  38.  
  39. procedure DInit()               //database structure definition
  40.   oD:AddDbf("Employ")           //new database (file) name
  41.   oD:AddField("Name", "C",20)   //field definition: FieldName,Type,Length,Dec
  42.   oD:AddField("Birth","D")      //...date...
  43.   oD:AddField("Pay",  "N",8,2)  //...numeric...
  44.   oD:AddField("Note", "M")      //...memo...
  45.   return
  46.  
  47. procedure VInit()                                          //view definition
  48.   oV:Select("Employ")                                      //primary (selected) database
  49.   oV:AddField("First & last name","Name", "field->Name")   //fields definition for wiew and report
  50.   oV:AddField("Annual pay",       "Pay",  "field->Pay")    //(read_name,browse_name,field_name_from_dbf)
  51.   oV:AddField("Birth date",       "Birth","field->Birth")  //...
  52.   oV:AddMemo( "Remarks",          "Rem.", "field->Note")   //...
  53.   return
  54.  
  55. procedure MInit()                                       //menu structure definition
  56.   oM:AddBar("~File")                                    //new item into bar line
  57.     oM:AddView("~Employees","Employees", oV)            //submenu_view: menu_name, window_name, object
  58.     oM:AddItem("Text ~file",   {||FInfoShow()})         //simple menu item: menu_name, action
  59.     oM:AddItem("E~xit  Alt-X", {||oM:Done()}, K_ALT_X)  //... with "hot_key"
  60.   oM:AddBar("~Archiv")
  61.     oM:AddItem("~Save on disk a:", {||oD:Save("a:")})
  62.     oM:AddItem("~Restore from disk a:", {||oD:Load("a:")})
  63.   oM:AddBar("~Problems?")
  64.     oM:AddItem("~Reindex", {||oD:ReIndex()})
  65.     oM:AddItem("~Pack", {||oD:Pack()})
  66.     oM:AddItem("~Change password", {|i|oM:Password(i)})
  67.     oM:AddCheck("~Wrap menu", {|i,v|Set(_SET_WRAP,v)})
  68.   return
  69.  
  70. //
  71. //All program is only linear describe of desired actions,
  72. //without any jumps, loops, ...
  73. //without any screen positionning commands,
  74. //with the minimal possibility to create any error.
  75. //
  76. //Remember: 
  77. //this is a NET version, a program created by with OBJECT.lib has NET capability
  78. //
  79. //Excuse me, please, for my terrible english. Many thanks.
  80. //(Have you any job for me?)
  81. //
  82. //˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ it is REALLY end of program ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙
  83.